/*
 * INSANE - Interactive Structural Analysis Environment
 *
 * Copyright (C) 2003-2006
 * Universidade Federal de Minas Gerais
 * Escola de Engenharia
 * Departamento de Engenharia de Estruturas
 *
 * Author's email :     insane@dees.ufmg.br
 * Author's Website :   http://www.dees.ufmg.br/insane
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */

package br.ufmg.dees.insane.draw;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape;
import java.util.Vector;

/**
 * @author Fonseca, Flavio & Pitangueira, Roque
 * @since	April 2004
 */
public abstract class RestraintsDraw extends Draw{
	
//	*******************************************************************************	
	public static class X extends RestraintsDraw {
		Point p0;
		Point p1;
		Point p2;
		
		public X(Point p0,Point p1,Point p2) {
			this(p0);
			this.p0 = p0;
			this.p1 = p1;
			this.p2 = p2;
		}
		
		public X(Point loc) {
			this(loc, null);
		}
		
		public X(Point loc, Object represents) {
			this.setLocation(loc);
			this.setRepresents(represents);
		}        
		
		public Vector<Object> getShapes() {
			return null;
		}
		
		
		/**
		 * Draws in a given Graphics.
		 * @see   java.awt.Graphics
		 */
		public void draw(Graphics2D g2) {
			int[] x = {p0.x,p1.x,p2.x};
			int[] y = {p0.y,p1.y,p2.y};
			Shape s = new Polygon(x,y,3);
			
			Color temp = g2.getColor();
			Color blue = new Color(0.0f,0.0f,1.0f,0.5f);
			g2.setColor(blue);
			g2.fill(s);
			blue = new Color(0.0f,0.0f,1.0f);
			g2.setColor(blue);
			g2.draw(s);
			g2.setColor(temp);
			
			//	  g2.drawString("Dx",p1.x-20,p0.y);
		} 
		
		/**
		 * Returns the draw bounds in device units.
		 * @return the draw bounds
		 */
		public Rectangle getBounds() {
			return null;
		}
		
	}//end of this class
	
//	*****************************************************************************		    
	
	public static class Y extends RestraintsDraw {
		Point p0;
		Point p1;
		Point p2;
		
		public Y(Point p0,Point p1,Point p2) {
			this(p0);
			this.p0 = p0;
			this.p1 = p1;
			this.p2 = p2;
		}
		
		public Y(Point loc) {
			this(loc, null);
		}
		
		public Y(Point loc, Object represents) {
			this.setLocation(loc);
			this.setRepresents(represents);
		}        
		
		public Vector<Object> getShapes() {
			return null;
		}
		
		
		/**
		 * Draws in a given Graphics.
		 * @see   java.awt.Graphics
		 */
		public void draw(Graphics2D g2) {
			int[] x = {p0.x,p1.x,p2.x};
			int[] y = {p0.y,p1.y,p2.y};
			Shape s = new Polygon(x,y,3);
			
			Color temp = g2.getColor();
			Color red = new Color(1.0f,0.0f,0.0f,0.5f);
			g2.setColor(red);
			g2.fill(s);
			red = new Color(1.0f,0.0f,0.0f);
			g2.setColor(red);
			g2.draw(s);
			g2.setColor(temp);
//			g2.drawString("Dy",p0.x,p1.y+20);
		} 
		
		/**
		 * Returns the draw bounds in device units.
		 * @return the draw bounds
		 */
		public Rectangle getBounds() {
			return null;
		}
		
	}//end of this class
	
//	*****************************************************************************	
	public static class Z extends RestraintsDraw {
		Point p0;
		Point p1;
		Point p2;
		Point p3;
		Point p4;
		
		public Z(Point p0,Point p1,Point p2,Point p3,Point p4) {
			this(p0);
			this.p0 = p0;
			this.p1 = p1;
			this.p2 = p2;
			this.p3 = p3;
			this.p4 = p4;
		}
		
		public Z(Point loc) {
			this(loc, null);
		}
		
		public Z(Point loc, Object represents) {
			this.setLocation(loc);
			this.setRepresents(represents);
		}        
		
		public Vector<Object> getShapes() {
			return null;
		}
		
		
		/**
		 * Draws in a given Graphics.
		 * @see   java.awt.Graphics
		 */
		public void draw(Graphics2D g2) {
			int[] x1 = {p0.x,p1.x,p2.x};
			int[] y1 = {p0.y,p1.y,p2.y};
			int[] x2 = {p0.x,p2.x,p3.x};
			int[] y2 = {p0.y,p2.y,p3.y};
			int[] x3 = {p0.x,p3.x,p4.x};
			int[] y3 = {p0.y,p3.y,p4.y};
			int[] x4 = {p0.x,p1.x,p4.x};
			int[] y4 = {p0.y,p1.y,p4.y};
			int[] x5 = {p1.x,p2.x,p3.x,p4.x};
			int[] y5 = {p1.y,p2.y,p3.y,p4.y};
			Shape s1 = new Polygon(x1,y1,3);
			Shape s2 = new Polygon(x2,y2,3);
			Shape s3 = new Polygon(x3,y3,3);
			Shape s4 = new Polygon(x4,y4,3);
			Shape s5 = new Polygon(x5,y5,4);
			
			Color temp = g2.getColor();
			Color green = new Color(0.0f,1.0f,0.0f,0.3f);
			//	  Color green = new Color(0.6f,0.0f,0.6f,0.3f);
			g2.setColor(green);
			g2.fill(s1);
			g2.fill(s2);
			g2.fill(s3);
			g2.fill(s4);
			g2.fill(s5);
			green = new Color(0.0f,1.0f,0.0f);
			g2.setColor(green);
			g2.draw(s1);
			g2.draw(s2);
			g2.draw(s3);
			g2.draw(s4);
			g2.draw(s5);
			g2.setColor(temp);
		} 
		
		/**
		 * Returns the draw bounds in device units.
		 * @return the draw bounds
		 */
		public Rectangle getBounds() {
			return null;
		}
		
	}//end of this class
//	*****************************************************************************	
	public static class XYZ extends RestraintsDraw {
		Point p0;
		Point p1;
		Point p2;
		Point p3;
		Point p4;
		Point p5;
		Point p6;
		Point p7;
		Point p8;
		Point p9;
		
		public XYZ(Point[] pl) {
			this(pl[0]);
			this.p0 = pl[0];
			this.p1 = pl[1];
			this.p2 = pl[2];
			this.p3 = pl[3];
			this.p4 = pl[4];
			this.p5 = pl[5];
			this.p6 = pl[6];
			this.p7 = pl[7];
			this.p8 = pl[8];
			this.p9 = pl[9];
		}
		
		public XYZ(Point loc) {
			this(loc, null);
		}
		
		public XYZ(Point loc, Object represents) {
			this.setLocation(loc);
			this.setRepresents(represents);
		}        
		
		public Vector<Object> getShapes() {
			return null;
		}
		
		
		/**
		 * Draws in a given Graphics.
		 * @see   java.awt.Graphics
		 */
		public void draw(Graphics2D g2) {
			int[] x1 = {p1.x,p2.x,p3.x,p4.x};
			int[] y1 = {p1.y,p2.y,p3.y,p4.y};
			int[] x2 = {p5.x,p6.x,p7.x,p8.x};
			int[] y2 = {p5.y,p6.y,p7.y,p8.y};
			int[] x3 = {p5.x,p1.x,p2.x,p6.x};
			int[] y3 = {p5.y,p1.y,p2.y,p6.y};
			int[] x4 = {p6.x,p2.x,p3.x,p7.x};
			int[] y4 = {p6.y,p2.y,p3.y,p7.y};
			int[] x5 = {p7.x,p3.x,p4.x,p8.x};
			int[] y5 = {p7.y,p3.y,p4.y,p8.y};
			int[] x6 = {p4.x,p8.x,p5.x,p1.x};
			int[] y6 = {p4.y,p8.y,p5.y,p1.y};
			
			Shape s1 = new Polygon(x1,y1,4);
			Shape s2 = new Polygon(x2,y2,4);
			Shape s3 = new Polygon(x3,y3,4);
			Shape s4 = new Polygon(x4,y4,4);
			Shape s5 = new Polygon(x5,y5,4);
			Shape s6 = new Polygon(x6,y6,4);
			
			//g2.drawRect();
			
			Color temp = g2.getColor();
			//	  Color green = new Color(0.0f,1.0f,0.0f);
			Color green = new Color(0.0f,1.0f,0.0f,0.3f);
			g2.setColor(green);
			g2.fill(s1);
			g2.fill(s2);
			g2.fill(s3);
			g2.fill(s4);
			g2.fill(s5);
			g2.fill(s6);
			green = new Color(0.0f,1.0f,0.0f);
			g2.setColor(green);
			g2.draw(s1);
			g2.draw(s2);
			g2.draw(s3);
			g2.draw(s4);
			g2.draw(s5);
			g2.draw(s6);
			g2.drawLine(p0.x,p0.y,p9.x,p9.y);
			g2.setColor(temp);
			
		} 
		
		/**
		 * Returns the draw bounds in device units.
		 * @return the draw bounds
		 */
		public Rectangle getBounds() {
			return null;
		}
		
	}//end of this class
//	*****************************************************************************	
	public static class RX extends RestraintsDraw {
		Point p0;
		Point p1;
		Point p2;
		Point p3;
		Point p4;
		Point p5;
		
		public RX(Point p0,Point p1,Point p2,Point p3,Point p4,Point p5) {
			this(p0);
			this.p0 = p0;
			this.p1 = p1;
			this.p2 = p2;
			this.p3 = p3;
			this.p4 = p4;
			this.p5 = p5;
		}
		
		public RX(Point loc) {
			this(loc, null);
		}
		
		public RX(Point loc, Object represents) {
			this.setLocation(loc);
			this.setRepresents(represents);
		}        
		
		public Vector<Object> getShapes() {
			return null;
		}
		
		
		/**
		 * Draws in a given Graphics.
		 * @see   java.awt.Graphics
		 */
		public void draw(Graphics2D g2) {
			int[] x = {p1.x,p2.x,p3.x,p4.x};
			int[] y = {p1.y,p2.y,p3.y,p4.y};
			
			Shape s = new Polygon(x,y,4);
			
			Color temp = g2.getColor();
			// Color blue = new Color(0.0f,0.0f,1.0f,0.5f);
			Color blue = new Color(0.4f,0.8f,1.0f,0.5f);
			g2.setColor(blue);
			g2.fill(s);
			blue = new Color(0.4f,0.8f,1.0f);
			g2.setColor(blue);
			g2.draw(s);
			g2.drawLine(p0.x,p0.y,p5.x,p5.y);
			
			g2.setColor(temp);
			
		} 
		
		/**
		 * Returns the draw bounds in device units.
		 * @return the draw bounds
		 */
		public Rectangle getBounds() {
			return null;
		}
		
	}//end of this class
//	*****************************************************************************	
	public static class RY extends RestraintsDraw {
		Point p0;
		Point p1;
		Point p2;
		Point p3;
		Point p4;
		Point p5;
		
		public RY(Point p0,Point p1,Point p2,Point p3,Point p4,Point p5) {
			this(p0);
			this.p0 = p0;
			this.p1 = p1;
			this.p2 = p2;
			this.p3 = p3;
			this.p4 = p4;
			this.p5 = p5;
		}
		
		public RY(Point loc) {
			this(loc, null);
		}
		
		public RY(Point loc, Object represents) {
			this.setLocation(loc);
			this.setRepresents(represents);
		}        
		
		public Vector<Object> getShapes() {
			return null;
		}
		
		
		/**
		 * Draws in a given Graphics.
		 * @see   java.awt.Graphics
		 */
		public void draw(Graphics2D g2) {
			int[] x = {p1.x,p2.x,p3.x,p4.x};
			int[] y = {p1.y,p2.y,p3.y,p4.y};
			
			Shape s = new Polygon(x,y,4);
			
			Color temp = g2.getColor();
			// Color blue = new Color(0.0f,0.0f,1.0f,0.5f);
			Color red = new Color(0.6f,0.0f,0.0f,0.5f);
			g2.setColor(red);
			g2.fill(s);
			red = new Color(0.6f,0.0f,0.0f);
			g2.setColor(red);
			g2.draw(s);
			g2.drawLine(p0.x,p0.y,p5.x,p5.y);
			
			g2.setColor(temp);
			
		} 
		
		/**
		 * Returns the draw bounds in device units.
		 * @return the draw bounds
		 */
		public Rectangle getBounds() {
			return null;
		}
	}//end of this class
//	*****************************************************************************	
	
	public static class RZ extends RestraintsDraw {
		Point p0;
		Point p1;
		Point p2;
		Point p3;
		Point p4;
		Point p5;
		
		public RZ(Point p0,Point p1,Point p2,Point p3,Point p4,Point p5) {
			this(p0);
			this.p0 = p0;
			this.p1 = p1;
			this.p2 = p2;
			this.p3 = p3;
			this.p4 = p4;
			this.p5 = p5;
		}
		
		public RZ(Point loc) {
			this(loc, null);
		}
		
		public RZ(Point loc, Object represents) {
			this.setLocation(loc);
			this.setRepresents(represents);
		}        
		
		public Vector<Object> getShapes() {
			return null;
		}
		
		
		/**
		 * Draws in a given Graphics.
		 * @see   java.awt.Graphics
		 */
		public void draw(Graphics2D g2) {
			int[] x = {p1.x,p2.x,p3.x,p4.x};
			int[] y = {p1.y,p2.y,p3.y,p4.y};
			
			Shape s = new Polygon(x,y,4);
			
			Color temp = g2.getColor();
			Color green = new Color(0.0f,0.8f,0.2f,0.5f);
			g2.setColor(green);
			g2.fill(s);
			green = new Color(0.0f,0.8f,0.2f);
			g2.setColor(green);
			g2.draw(s);
			g2.drawLine(p0.x,p0.y,p5.x,p5.y);
			
			g2.setColor(temp);
			
		} 
		
		/**
		 * Returns the draw bounds in device units.
		 * @return the draw bounds
		 */
		public Rectangle getBounds() {
			return null;
		}
	}//end of this class
//	*****************************************************************************	
}
